package dparish.shared.entity;

import javax.persistence.Id;

/**
 * Base class for objects that are held in appengine.  Based on:
 * @see <a href="http://turbomanage.wordpress.com/2011/03/25/using-gwt-requestfactory-with-objectify/">Using RequestFactor with Objectify</a>
 * @author dparish
 *
 */
public class DatastoreObject {

	
	// All objects will have a long id as their primary key in the datastor.
	@Id
	private Long id;
	
	// RequestFactory needs a version to track changes.
	private Integer version=0;
	
	// Called when we do a store or update to show that the version has changed.
	public void onPersist() {
		version++;
	}

	public Long getId() {
		return id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	public Integer getVersion() {
		return version;
	}

	public void setVersion(Integer version) {
		this.version = version;
	}
}
